/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.liquidByte.trafficMustang.server.dataModel;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Alexandre
 */
@Entity
@Table(name = "usr")
public class Usuario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "USR_ID")
    private Integer usrId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 80)
    @Column(name = "USR_NM")
    private String usrNm;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "USR_DOC_ID")
    private String usrDocId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "USR_QLF_TOT")
    private int usrQlfTot;
    @Basic(optional = false)
    @NotNull
    @Column(name = "USR_QLF")
    private int usrQlf;
    @Basic(optional = false)
    @NotNull
    @Column(name = "USR_VERF")
    private boolean usrVerf;
    @Basic(optional = false)
    @NotNull
    @Column(name = "USR_SENHA", nullable = false, length = 32)
    private String senha;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "usrId", orphanRemoval=true)
    private List<DestinoComum> destinoComumList;
    @OneToOne(cascade ={CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, mappedBy = "usuario")
    private Conta conta;
    @OneToOne(mappedBy = "usuario")
    private Motorista motorista;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "usuario", orphanRemoval=true)
    private List<UsuarioTelefone> usuarioTelefoneList;
    @OneToOne(mappedBy = "usuario")
    private Passageiro passageiro;
    @OneToMany(mappedBy = "usrIdAvlr")
    private List<Avaliacao> avaliacaoAvaliadorList;
    @OneToMany(mappedBy = "usrIdAvld")
    private List<Avaliacao> avaliacaoAvaliadoList;
    @OneToMany(mappedBy = "usuario")
    private List<Rastreamento> rastreamentoList;

    public Usuario() {
    }

    public Usuario(Integer usrId) {
        this.usrId = usrId;
    }

    public Usuario(Integer usrId, String usrNm, String usrDocId, int usrQlfTot, int usrQlf, boolean usrVerf) {
        this.usrId = usrId;
        this.usrNm = usrNm;
        this.usrDocId = usrDocId;
        this.usrQlfTot = usrQlfTot;
        this.usrQlf = usrQlf;
        this.usrVerf = usrVerf;
    }

    public Integer getUsrId() {
        return usrId;
    }

    public void setUsrId(Integer usrId) {
        this.usrId = usrId;
    }

    public String getUsrNm() {
        return usrNm;
    }

    public void setUsrNm(String usrNm) {
        this.usrNm = usrNm;
    }

    public String getUsrDocId() {
        return usrDocId;
    }

    public void setUsrDocId(String usrDocId) {
        this.usrDocId = usrDocId;
    }

    public int getUsrQlfTot() {
        return usrQlfTot;
    }

    public void setUsrQlfTot(int usrQlfTot) {
        this.usrQlfTot = usrQlfTot;
    }

    public int getUsrQlf() {
        return usrQlf;
    }

    public void setUsrQlf(int usrQlf) {
        this.usrQlf = usrQlf;
    }

    public boolean getUsrVerf() {
        return usrVerf;
    }

    public void setUsrVerf(boolean usrVerf) {
        this.usrVerf = usrVerf;
    }

    public List<DestinoComum> getDestinoComumList() {
        return destinoComumList;
    }

    public void setDestinoComumList(List<DestinoComum> destinoComumList) {
        this.destinoComumList = destinoComumList;
    }

    public Conta getConta() {
        return conta;
    }

    public void setConta(Conta conta) {
        this.conta = conta;
    }

    public Motorista getMotorista() {
        return motorista;
    }

    public void setMotorista(Motorista motorista) {
        this.motorista = motorista;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }
    
    public List<UsuarioTelefone> getUsuarioTelefoneList() {
        return usuarioTelefoneList;
    }

    public void setUsuarioTelefoneList(List<UsuarioTelefone> usuarioTelefoneList) {
        this.usuarioTelefoneList = usuarioTelefoneList;
    }

    public Passageiro getPassageiro() {
        return passageiro;
    }

    public void setPassageiro(Passageiro passageiro) {
        this.passageiro = passageiro;
    }

    public List<Avaliacao> getAvaliacaoAvaliadorList() {
        return avaliacaoAvaliadorList;
    }

    public void setAvaliacaoAvaliadorList(List<Avaliacao> avaliacaoList) {
        this.avaliacaoAvaliadorList = avaliacaoList;
    }

    public List<Avaliacao> getAvaliacaoAvaliadoList() {
        return avaliacaoAvaliadoList;
    }

    public void setAvaliacaoAvaliadoList(List<Avaliacao> avaliacaoList1) {
        this.avaliacaoAvaliadoList = avaliacaoList1;
    }

    public List<Rastreamento> getRastreamentoList() {
        return rastreamentoList;
    }

    public void setRastreamentoList(List<Rastreamento> rastreamentoList) {
        this.rastreamentoList = rastreamentoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (usrId != null ? usrId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Usuario)) {
            return false;
        }
        Usuario other = (Usuario) object;
        if ((this.usrId == null && other.usrId != null) || (this.usrId != null && !this.usrId.equals(other.usrId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.liquidByte.trafficMustang.server.dataModel.Usuario[ usrId=" + usrId + " ]";
    }
    
}
